using System;
using System.Collections.Generic;
using System.Text;

using PickGold.Database;
using DataCommon = PickGold.Database.Common;

namespace PickGold.Entities.Table
{
    public class CBaseUserOnline : CBaseTable
    {
        public const string ENTITY_NAME = "tb_sys_user_online";
        public const string ENTITY_ALIAS = "online";
		public const string ENTITY_KEY = DataCommon.ONLINE_ID;
		public const string ENTITY_SYMBOL = DataCommon.ONLINE_NAME;
        //
        public const string USER_BOSS = "user_boss";
        public const string USER_SPACE = "user_space";
        public const string USER_ID = CBaseUserInfo.ENTITY_KEY;
        public const string SESS_ID = "session_id";
        public const string USER_FROM = "user_from";
        public const string START_TIME = "start_time";
        public const string LOGIN_TIME = "login_time";
        public const string PAGE_URL = "page_url";
        public const string PAGE_TITLE = "page_title";
        public const string PAGE_TIMES = "page_times";
        public const string REQUEST_TIMES = "request_times";
        public const string PAGE_TIMESLICE = "page_timeslice";
        //
        private SBaseUserOnline _ = null;
        //
        public CBaseUserOnline() : base(ENTITY_NAME) { }
        public CBaseUserOnline(CDatabase db) : base(db, ENTITY_NAME) { }
        public CBaseUserOnline(string alias) : base(ENTITY_NAME, alias) { }
        public CBaseUserOnline(CDatabase db, string alias) : base(db, ENTITY_NAME, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SBaseUserOnline());
        }
        protected void SetSchema(SBaseUserOnline s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(USER_BOSS, typeof(long)).DefaultValue = this._.UserBoss;
            this._DataTable.Columns.Add(USER_SPACE, typeof(long)).DefaultValue = this._.UserSpace;
            this._DataTable.Columns.Add(USER_ID, typeof(long)).DefaultValue = this._.UserID;
            this._DataTable.Columns.Add(SESS_ID, typeof(string)).MaxLength = 50;
            this._DataTable.Columns.Add(USER_FROM, typeof(long)).DefaultValue = this._.UserFrom;
            this._DataTable.Columns.Add(START_TIME, typeof(DateTime)).DefaultValue = this._.StartTime;
            this._DataTable.Columns.Add(LOGIN_TIME, typeof(DateTime)).DefaultValue = this._.LoginTime;
            this._DataTable.Columns.Add(PAGE_URL, typeof(string)).MaxLength = 256;
            this._DataTable.Columns.Add(PAGE_TITLE, typeof(string)).MaxLength = 256;
            this._DataTable.Columns.Add(PAGE_TIMES, typeof(int)).DefaultValue = this._.PageTimes;
            this._DataTable.Columns.Add(REQUEST_TIMES, typeof(int)).DefaultValue = this._.RequestTimes;
            this._DataTable.Columns.Add(PAGE_TIMESLICE, typeof(int)).DefaultValue = this._.PageTimeslice;
        }
        //
        #region Property
        //
        public virtual long UserBoss
        {
            set
            {
				if (this._DataTable.Columns[USER_BOSS] == null)
					return;

                this._.UserBoss = value;
                this.SetValue(USER_BOSS, value);
            }
            get
            {
                return this._.UserBoss;
            }
        }
        //
        public virtual long UserSpace
        {
            set
            {
				if (this._DataTable.Columns[USER_SPACE] == null)
					return;

				this._.UserSpace = value;
                this.SetValue(USER_SPACE, value);
            }
            get
            {
                return this._.UserSpace;
            }
        }
        //
        public virtual long UserID
        {
            set
            {
                this._.UserID = value;
                this.SetValue(USER_ID, value);
            }
            get
            {
                return this._.UserID;
            }
        }
        //
        public virtual string SessID
        {
            set
            {
                this._.SessID = value;
                this.SetValue(SESS_ID, value);
            }
            get
            {
                return this._.SessID;
            }
        }
        //
        public virtual long UserFrom
        {
            set
            {
                this._.UserFrom = value;
                this.SetValue(USER_FROM, value);
            }
            get
            {
                return this._.UserFrom;
            }
        }
        //
        public virtual DateTime StartTime
        {
            set
            {
                this._.StartTime = value;
                this.SetValue(START_TIME, value);
            }
            get
            {
                return this._.StartTime;
            }
        }
        //
        public virtual DateTime LoginTime
        {
            set
            {
                this._.LoginTime = value;
                this.SetValue(LOGIN_TIME, value);
            }
            get
            {
                return this._.LoginTime;
            }
        }
        //
        public virtual string PageUrl
        {
            set
            {
                this._.PageUrl = value;
                this.SetValue(PAGE_URL, value);
            }
            get
            {
                return this._.PageUrl;
            }
        }
        //
        public virtual string PageTitle
        {
            set
            {
                this._.PageTitle = value;
                this.SetValue(PAGE_TITLE, value);
            }
            get
            {
                return this._.PageTitle;
            }
        }
        //
        public virtual int PageTimes
        {
            set
            {
                this._.PageTimes = value;
                this.SetValue(PAGE_TIMES, value);
            }
            get
            {
                return this._.PageTimes;
            }
        }
        //
        public virtual int RequestTimes
        {
            set
            {
                this._.RequestTimes = value;
                this.SetValue(REQUEST_TIMES, value);
            }
            get
            {
                return this._.RequestTimes;
            }
        }
        //
        public virtual int PageTimeslice
        {
            set
            {
                this._.PageTimeslice = value;
                this.SetValue(PAGE_TIMESLICE, value);
            }
            get
            {
                return this._.PageTimeslice;
            }
        }
        //
        #endregion
        //
        public override bool MoveTo(int position)
        {
            if (!base.MoveTo(position))
                return false;

            this._.UserBoss = this.GetValue<long>(USER_BOSS, true);
            this._.UserSpace = this.GetValue<long>(USER_SPACE, true);
            this._.UserID = this.GetValue<long>(USER_ID);
            this._.SessID = this.GetValue<string>(SESS_ID);
            this._.UserFrom = this.GetValue<long>(USER_FROM);
            this._.StartTime = this.GetValue<DateTime>(START_TIME);
            this._.LoginTime = this.GetValue<DateTime>(LOGIN_TIME);
            this._.PageUrl = this.GetValue<string>(PAGE_URL);
            this._.PageTitle = this.GetValue<string>(PAGE_TITLE);
            this._.PageTimes = this.GetValue<int>(PAGE_TIMES);
            this._.RequestTimes = this.GetValue<int>(REQUEST_TIMES);
            this._.PageTimeslice = this.GetValue<int>(PAGE_TIMESLICE);
            return true;
        }
        //
    }
    //
    public class SBaseUserOnline : SBaseTable
    {
        //
        public long UserBoss = -1;
        public long UserSpace = -1;
        public long UserID = -1;
        public string SessID = null;
        public long UserFrom = 0;
        public DateTime StartTime = DateTime.MinValue;
        public DateTime LoginTime = DateTime.MinValue;
        public string PageUrl = null;
        public string PageTitle = null;
        public int PageTimes = 0;
        public int RequestTimes = 0;
        public int PageTimeslice = 0;
        //
    }
    //
}
//
